home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-29 | 2.9 KB | 85 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class DefaultAppleMenu
- %
- % Part of the Lund Software interface to Macintosh Toolbox
- % DefaultAppleMenu is designed to act as the first alternative
- % in the MenuBar. It (hopefully) acts as a standard Apple menu.
- % An aplication using this class will not need to bother about
- % desk accesoirs.
- %
- % 890413/Boris Magnusson
- %
- % ---------------------------------------------------------------------------
- External class MacRect="::SInterfaces:macRect";
- External class MacEvent="::SInterfaces:macEvent";
- External class MacMenu="::SInterfaces:MacMenu";
- External class macMenuItem="::SInterfaces:MacMenuItem";
- External class toolboxMenu="::SInterfaces:toolboxMenu";
- External class toolboxEvent="::SInterfaces:toolboxEvent";
- External class MacDeskmgr="::Sinterfaces:Macdeskmgr";
- MacMenu class DefaultAppleMenu;
- begin
- ref(toolboxMenu) TRAP;
- ref(macdeskmgr) desk;
-
- ! This procedure is virtually bound and replaces the default one in MacMenu.
- ! It is called from MenuBar each time a menu item in the apple menu is selected.
- ;
- procedure doMenu(menuid,item); integer menuid,item;
- begin
- ref(macMenuItem) userAlternative;
- text theAcc;
- if Item=1 then
- begin
- UserAlternative:- FindItem(Item);
- if Useralternative=/=None then
- Useralternative.doMenu(menuid,Item)
- else
- begin
- ! Window describing the application ;
- ref(macWindow) tempW;
- text T;
- ref(macRect) Wbounds;
- ref(macEvent) theEvent;
- ref(ToolboxEvent) TRAP;
- integer mousedownmask=2;
- wbounds:- new macRect;
- inspect wbounds do
- begin top:=50;left:=50;bottom:=50+85;right:=50+250; end;
- theEvent:-new macEvent;
- TRAP:-new TOOLBOXEvent;
- tempW:-new macWindow;
- tempW.newWindow(Wbounds," ",true,1,none,false,0);
- tempW.setport;
- tempW.MoveTo(10,10);T:-"This application was developed using";tempW.drawText(T,0,T.length);
- tempW.MoveTo(10,25);T:-"the Lund SIMULA system from";tempW.drawText(T,0,T.length);
- tempW.MoveTo(10,50);T:-" Lund Software House AB";tempW.drawText(T,0,T.length);
- tempW.MoveTo(10,65);T:-" Box 7056";tempW.drawText(T,0,T.length);
- tempW.MoveTo(10,80);T:-" S-220 07 LUND, Sweden";tempW.drawText(T,0,T.length);
- ! -- This code temporarily takes control away from the processmgr ! -- ;
- while not TRAP.TOOLBOXgetnextEvent(mousedownmask,theEvent.what) do ;
- tempW.disposeWindow;
- end;
- end
- else
- begin
- ! run a desk-accesoir;
- theAcc:-blanks(256);
-
- TRAP.toolboxGetItem(menuhandle,item,theAcc);
- theAcc:-string_text(theAcc);
- Desk.openDeskAcc(theAcc);
- end;
- end -- do menu -- ;
-
- ! -- initialization - build the menu -- ;
-
- TRAP:-new toolboxmenu;
- desk:-new macdeskmgr;
-
- newMenu(32000,"!20!"); !the small apple - !20!=16R14 or $14 ;
- AppendMenu("About Simula...");
- AppendMenu("-");
- AddResmenu("DRVR"); ! add all Desk acc, in system file resources ;
-
- END --- Default Apple Menu --- ;